Key Listener for Apply Button

Hello All,

How can I make an apply button work when "Enter" key in the keyboard is pressed?

I could see that the enter key works fine on the Login Dailog, Filter Dailog, etc which is also developed in DXL.

But, when I develop my own dialog with an apply button with text "Ok", it is not getting called when Enter key is pressed in the keyboard. The user always has to use his/her mouse to use it.

Any information on this will be of great help.

Thanks & Regards
Irfan
Irfan_Jamal - Tue Oct 19 05:47:32 EDT 2010

Re: Key Listener for Apply Button
SystemAdmin - Tue Oct 19 08:41:22 EDT 2010

You have to "setFocus" on that dialog box element:

DB MainDB = create "Button test"
 
void doClose(DBE x) 
{
    // for button
   ack "close"
    hide MainDB
   destroy MainDB
   MainDB = null
}
void doClose(DB x) 
{
   for apply or button
   ack "close"
    hide MainDB
   destroy MainDB
   MainDB = null
}
 
DBE but1 = apply(MainDB, "Button", doClose) 
setFocus (but1)
show MainDB

 


Testing the above "apply", "button" and "ok" dialog box functions seemed to work here, e.g. the MainDB was closed by pressing Enter. In addition to this the DOORS standard "close" button will be activated by escape.